package com.cleaningcloud.cld.controller;

import java.util.List;

import com.cleaningcloud.cld.domain.dto.CldDegreetitleDto;
import com.cleaningcloud.cld.domain.vo.CldDegreetitleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cleaningcloud.common.log.annotation.Log;
import com.cleaningcloud.common.log.enums.BusinessType;
import com.cleaningcloud.common.security.annotation.RequiresPermissions;
import com.cleaningcloud.cld.domain.CldDegreetitle;
import com.cleaningcloud.cld.service.ICldDegreetitleService;
import com.cleaningcloud.common.core.web.controller.BaseController;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import com.cleaningcloud.common.core.utils.poi.ExcelUtil;
import com.cleaningcloud.common.core.web.page.TableDataInfo;

/**
 * 员工满意度主题Controller
 * 
 * @author cleaningcloud
 * @date 2024-10-27
 */
@RestController
@RequestMapping("/degreetitle")
public class CldDegreetitleController extends BaseController
{
    @Autowired
    private ICldDegreetitleService cldDegreetitleService;

    /**
     * 查询员工满意度主题列表
     */
    @RequiresPermissions("cld:degreetitle:list")
    @GetMapping("/list")
    public TableDataInfo list(CldDegreetitleDto cldDegreetitle)
    {
        startPage();
        List<CldDegreetitleVo> list = cldDegreetitleService.selectCldDegreetitleList(cldDegreetitle);
        return getDataTable(list);
    }


    /**
     * 查询员工满意度主题列表
     */
    @RequiresPermissions("cld:degreetitle:list")
    @GetMapping("/getDegreeTitleList")
    public AjaxResult getDegreeTitleList(CldDegreetitleDto cldDegreetitle)
    {
        List<CldDegreetitleVo> list = cldDegreetitleService.selectCldDegreetitleList(cldDegreetitle);
        return success(list);
    }


    /**
     * 获取员工满意度主题详细信息
     */
    @RequiresPermissions("cld:degreetitle:query")
    @GetMapping(value = "/{degreetitleId}")
    public AjaxResult getInfo(@PathVariable("degreetitleId") Long degreetitleId)
    {
        return success(cldDegreetitleService.selectCldDegreetitleByDegreetitleId(degreetitleId));
    }

    /**
     * 新增员工满意度主题
     */
    @RequiresPermissions("cld:degreetitle:add")
    @Log(title = "员工满意度主题", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CldDegreetitle cldDegreetitle)
    {
        return toAjax(cldDegreetitleService.insertCldDegreetitle(cldDegreetitle));
    }

    /**
     * 修改员工满意度主题
     */
    @RequiresPermissions("cld:degreetitle:edit")
    @Log(title = "员工满意度主题", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CldDegreetitle cldDegreetitle)
    {
        return toAjax(cldDegreetitleService.updateCldDegreetitle(cldDegreetitle));
    }


    /**
     * 发起调查项目
     */
    @RequiresPermissions("cld:degreetitle:survey")
    @PutMapping("/startSurvey")
    public AjaxResult startSurvey(@RequestBody CldDegreetitleDto cldDegreetitle)
    {
        return toAjax(cldDegreetitleService.startSurvey(cldDegreetitle));
    }

    /**
     * 删除员工满意度主题
     */
    @RequiresPermissions("cld:degreetitle:remove")
    @Log(title = "员工满意度主题", businessType = BusinessType.DELETE)
	@DeleteMapping("/{degreetitleIds}")
    public AjaxResult remove(@PathVariable Long[] degreetitleIds)
    {
        return toAjax(cldDegreetitleService.deleteCldDegreetitleByDegreetitleIds(degreetitleIds));
    }
}
